<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/11/1 0001
 * Time: 07:19
 */

namespace Admin\Controller;


use Think\Controller;

class UserController extends Controller{
    public function index(){
        if(IS_POST){
            $userInfo = M("AdminUser")->where(array('name'=>I('post.name')))->find();
            if($userInfo){
                $test = md5(C("MD5_SALT").I("post.password"));
                if(strtoupper(md5(C("MD5_SALT").I("post.password"))) == $userInfo['password']){
                    session("user_id",$userInfo["id"]);
                }
            }
            if(I("post.lottery")){
                $this->redirect("Home/Index/lottery");
            }else{
                $this->redirect("Index/index");
            }


        }
        $this->display();
    }

}